UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P4J+tydtjAxy380SiY+VmubiX9AsKWNSzdcTMx+yK0w=' 
WHERE 
  key_id = '1faf6c3996a749099a23d7730b9b83457399cb821941e4bcdcbd0e1e0d38be2c' 
  AND (
    token = 'P4J+tydtjAxy380SiY+VmubiX9AsKWNSzdcTMx+yK0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026