UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NuYZqkFh5+HauEYHXAd4TzOyY7iaS/2g6R8K+rlhl/c='
WHERE
key_id = '0fa66c8c7c53908676c17fd25cd615484e9a9732399c1b55e82ad0b73dff5dc3'
AND (
token = 'NuYZqkFh5+HauEYHXAd4TzOyY7iaS/2g6R8K+rlhl/c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)