UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nVRnk3dKxh1RADBeQ6ED44P/waRmlFKcXFZq101thps=' 
WHERE 
  key_id = 'd24836e9ad6d4879e81c9c7101199a1045e2f351f40cc3cecf96232a5345694e' 
  AND (
    token = 'nVRnk3dKxh1RADBeQ6ED44P/waRmlFKcXFZq101thps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036