UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RgF4i+9ELhnE+EZJgIhAgrQO4lSJ2FffyJMssBYL+KI='
WHERE
key_id = '383547584bdad0582c0020e3509d6f87212d8b9b20d67e397bba4a9872b85d87'
AND (
token = 'RgF4i+9ELhnE+EZJgIhAgrQO4lSJ2FffyJMssBYL+KI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)