UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vEzHVQdPTZBk9Ma1CVjDh6uCdQplVrA5mgiNLDH4oBQ=' 
WHERE 
  key_id = '29823f43fd4fc12896caef9cced617a89aa651988f6f736086148f3a118bc9a8' 
  AND (
    token = 'vEzHVQdPTZBk9Ma1CVjDh6uCdQplVrA5mgiNLDH4oBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039