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