UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w4dshhvFXq6pCWyBfOylByPPx2pg2KhZ5Qqohhrq4ZA=' 
WHERE 
  key_id = 'c399809a46b6a9a5e3afd134bc7e8aeb5b8d3e9fb948565d5c1abd5da8018060' 
  AND (
    token = 'w4dshhvFXq6pCWyBfOylByPPx2pg2KhZ5Qqohhrq4ZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025