UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z0sne14cGjbJ0u3exuWzpbNhJ8AJ2MPk+6XA3TbhHdE=' 
WHERE 
  key_id = 'a843be78ec2e22cb2b77a82669773bba7ee822b063195e44a8bf4688f12718c0' 
  AND (
    token = 'z0sne14cGjbJ0u3exuWzpbNhJ8AJ2MPk+6XA3TbhHdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025