UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '49MEctr8xnObvf4LfzVyZod1gW2V21yYmj+qyK/kEKs=' 
WHERE 
  key_id = '6eb9588fa229093e8a0a3655935141472ade80c4c04a2a20c02097440adce783' 
  AND (
    token = '49MEctr8xnObvf4LfzVyZod1gW2V21yYmj+qyK/kEKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079