UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NpdWML3Jr2ncUl7mgoeGqnxI6PjvrbHdsGxp7S3gTI8='
WHERE
key_id = '8d9811ee23dc683aa87c0a4b2446ed8e1e8f5262225623c84096b6674d11bc83'
AND (
token = 'NpdWML3Jr2ncUl7mgoeGqnxI6PjvrbHdsGxp7S3gTI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)