UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uHZXXMm9LQtGkMHvy1582yckWHZu0jTGe+pQ5DWCLUc='
WHERE
key_id = 'c31792ae9d73035f2b961ee29b2d6e4aaed18ab1897b892b0871cfe478c6fbf7'
AND (
token = 'uHZXXMm9LQtGkMHvy1582yckWHZu0jTGe+pQ5DWCLUc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)