UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZlP/anNKsOs9G1yLcBI8ZgBAEf97ORqS4VgRttTwY4A=' 
WHERE 
  key_id = '52b4972d48d614b42fc1c8b6b5c1e7dd505361e5e1004d0eda02d57072212c0f' 
  AND (
    token = 'ZlP/anNKsOs9G1yLcBI8ZgBAEf97ORqS4VgRttTwY4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034