UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j4zgmXH4VJbmI51YtT5XyrAOpjdNcs1IhQzTjILCff8='
WHERE
key_id = '70476f4c251d4d9dd52d55b865d7ec9ef0cf44042bb9a6bef11996c570e801bb'
AND (
token = 'j4zgmXH4VJbmI51YtT5XyrAOpjdNcs1IhQzTjILCff8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)