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

Query time 0.00048