UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vKoCvXLBua8W5hvRyaE3LzzF+h8gEZm29Ze25U7+cH8=' 
WHERE 
  key_id = 'ac84f17e3bf934894e9e38e50c7e29eea6ebb8b9ed76f3b6d0fc8f51d01e56c4' 
  AND (
    token = 'vKoCvXLBua8W5hvRyaE3LzzF+h8gEZm29Ze25U7+cH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049