UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n8cKuSKFf9/Aiy2YUt+RahG80S30BMFWZ7h+wmxKNV4='
WHERE
key_id = 'b2cd82458ffeb54c4e69ac5eb0f48bed99df54113b77719b705f58d971707dfb'
AND (
token = 'n8cKuSKFf9/Aiy2YUt+RahG80S30BMFWZ7h+wmxKNV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)