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

Query time 0.00024