UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't9bZPVBwshjEMJkc6xmI1EoWxDPVppk7Uc4R4bVbGlo='
WHERE
key_id = '3845b1af34361490fa8e83df7f2ab2dce54c4c77bb4a3b057467f845f29cfc11'
AND (
token = 't9bZPVBwshjEMJkc6xmI1EoWxDPVppk7Uc4R4bVbGlo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)