UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4mnkSYks6qzQrTAjO6G4HUgw95hJBQBimnCEigMM7yY='
WHERE
key_id = 'bd22c12bc3321c733e36c61153f31d9d2570f79a1e9f9e10baef42de031d0192'
AND (
token = '4mnkSYks6qzQrTAjO6G4HUgw95hJBQBimnCEigMM7yY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)