UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fGQHUatqLX4fZwNAz9WzoGe0NpuBP1Sgg1e0kaEJpM8='
WHERE
key_id = '9cec905d920170ff02f0944b4ccab8269a3c23bed56c0a114895a580ade27757'
AND (
token = 'fGQHUatqLX4fZwNAz9WzoGe0NpuBP1Sgg1e0kaEJpM8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)