UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TDDX1j28Rr/dsbQMjLlbE4MrgMkrg6igyMEFX3oor/Y='
WHERE
key_id = 'd11e82e8e8ac07c08114d5420a71e7ae956ba0c671f65b06a618acd58842e31a'
AND (
token = 'TDDX1j28Rr/dsbQMjLlbE4MrgMkrg6igyMEFX3oor/Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)