UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bSlow0dnXvdHCJis9wsdRba6AIUAm+e12esEJczmed8='
WHERE
key_id = 'd0dc14542e5608265d324837f189e9da9720f9926f8f6943d34f3aa5aa8e76e7'
AND (
token = 'bSlow0dnXvdHCJis9wsdRba6AIUAm+e12esEJczmed8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)