UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pmfsirAKLEyTSf2Jtku0Idl56UFlVSLwmUCWr1zwkL8='
WHERE
key_id = 'f3e142cc926260482bb176fc5dc02ce7fba3d97b975b67904318825c7e4eee2f'
AND (
token = 'pmfsirAKLEyTSf2Jtku0Idl56UFlVSLwmUCWr1zwkL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)