UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0gYF0qTvBN9N1snVPJH8LtRNuzkNOfJW3KBgEx4e0rU='
WHERE
key_id = 'e28009ebae9452a9750a266168c23fddc9b91785cd56bdcc1732ec695860e7b4'
AND (
token = '0gYF0qTvBN9N1snVPJH8LtRNuzkNOfJW3KBgEx4e0rU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)