UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'urn2NDdlX0rCPzbTSW7Ub72PZAIkx1pN5xDhgDoJNRQ=' 
WHERE 
  key_id = '778ba83f056444f0b9ea0a8c9bb0d38881e692d19bfa65df217b191b2db16b73' 
  AND (
    token = 'urn2NDdlX0rCPzbTSW7Ub72PZAIkx1pN5xDhgDoJNRQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032