UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jFt+CM8rbZzXRh8ba119bVtX1ZxHXsNtAowCfNYgeWY='
WHERE
key_id = 'c4f790eb2040e259351be2bf572f8b0943c5174176782137b5dc9576e2b20fa5'
AND (
token = 'jFt+CM8rbZzXRh8ba119bVtX1ZxHXsNtAowCfNYgeWY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)