UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bd5U/lmh902odsDPcvW563wbArr5DrZZAiyiiV0zYQ8='
WHERE
key_id = 'bf1a835ffc5e41c8d1fe1a547f1687765e2fe1328034a3ff016399f395411e16'
AND (
token = 'Bd5U/lmh902odsDPcvW563wbArr5DrZZAiyiiV0zYQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)