UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4UB9j4fbDhASLUXFC/KI35sNJexzhAQkCEhlZ+Shu6w=' 
WHERE 
  key_id = '71659a25e5b2c0cd804e743267cbae34d510415285ae4ea2942f789dcfd2e693' 
  AND (
    token = '4UB9j4fbDhASLUXFC/KI35sNJexzhAQkCEhlZ+Shu6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049