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