UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tYCHitmm6/MpGySWW75auGOGfCIXwLZdqWSZy9PUsp8=' 
WHERE 
  key_id = '3fad212589027c4ba32afede88fb73aae4950122c07e40b620a81c1ae04a388d' 
  AND (
    token = 'tYCHitmm6/MpGySWW75auGOGfCIXwLZdqWSZy9PUsp8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035