UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5xcuvf2vW3njkQfbc0QJADdEJ+JpO+7XVo0hPb63TLk='
WHERE
key_id = 'e9381e7b7af3bc9277581bca8f8894261c362057b735e05cd3d0ade2f69e1709'
AND (
token = '5xcuvf2vW3njkQfbc0QJADdEJ+JpO+7XVo0hPb63TLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)