UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dY+mzqHBrBLNY7tVjPsKcqmWvF9CQLfyplnFpOuPXrY='
WHERE
key_id = '168bde7f5d7bebc316f0c7731d15606cff117c977f1b0f1a2096f0a23f28d9ed'
AND (
token = 'dY+mzqHBrBLNY7tVjPsKcqmWvF9CQLfyplnFpOuPXrY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)