UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sDtgnKvDVjsO2gsosw+kIRCU/BZ3QWGW5F7DqRLe8Eo='
WHERE
key_id = 'ccb554c14cb04333d0b171452b4dd93de4b446b9f26e538f883bf080587b4613'
AND (
token = 'sDtgnKvDVjsO2gsosw+kIRCU/BZ3QWGW5F7DqRLe8Eo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)