UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bm9FA4yYOFcfydMB2GhFxxrb74s+i8tlA1vg7YkdR10='
WHERE
key_id = '82ce80b7727024b045b4c2a44c72dfc3e1b956fe6712a60a6a7aad9ee90b3233'
AND (
token = 'Bm9FA4yYOFcfydMB2GhFxxrb74s+i8tlA1vg7YkdR10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)