UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'foZL7wPn5DxhslTGBqTQUaKH6bF9EjEbNn2stxlT0c0='
WHERE
key_id = '3285ce235e2549f4ccf1bd39d5d9a29dbd39f4f9524766475c77653c46fa87c7'
AND (
token = 'foZL7wPn5DxhslTGBqTQUaKH6bF9EjEbNn2stxlT0c0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)