UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fhuo+ut29AI2bWaJBj458QAKAasXsD8kCkN8Bwsgv3k=' 
WHERE 
  key_id = '64d782956370033c02a17456136ccb0aa2b998a48afa80b68385d08f6d307dc2' 
  AND (
    token = 'fhuo+ut29AI2bWaJBj458QAKAasXsD8kCkN8Bwsgv3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032