UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CugANTcHb1CcuV79VWfSe+doDU/NhG4WHkBrkn3Fqfc='
WHERE
key_id = '7cc374977f439e194f8f2f575302fb5c64da5e35578a86d429d37a404e6aed5b'
AND (
token = 'CugANTcHb1CcuV79VWfSe+doDU/NhG4WHkBrkn3Fqfc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)