UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WwuaddKY8aZPKESBDvPR6dipjlCrrWanF+VNv7CSOvI=' 
WHERE 
  key_id = '3708fb4898e2a096bfeca94b85215d36db883694327a9397bea7859e78b5be19' 
  AND (
    token = 'WwuaddKY8aZPKESBDvPR6dipjlCrrWanF+VNv7CSOvI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029