UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OmgGVC3EjI+Ty2upmHNfTYF989EkbOBmUPqlFbbaAeE=' 
WHERE 
  key_id = 'e40be30a4c5a9f932a977809d078e8c36017decedfa6b873169d6d35338f8b37' 
  AND (
    token = 'OmgGVC3EjI+Ty2upmHNfTYF989EkbOBmUPqlFbbaAeE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026