UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wI0MYupSV+dz4iA+HZL5MbST5vrA6cdTZKJsZuOn0eU='
WHERE
key_id = 'a1daa43a0af28db0e958cdc1ad73f2d2c80a485b7dd86078a46f4177288a5b76'
AND (
token = 'wI0MYupSV+dz4iA+HZL5MbST5vrA6cdTZKJsZuOn0eU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)