UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QcwkuQS1P0QOkZ0caG7UMLAiioVu0FVoe9YfQG/6YSM='
WHERE
key_id = '47746b00a91f7fd553fc40cb8a7f528911760526bf0dd91a72f108dd93f40b70'
AND (
token = 'QcwkuQS1P0QOkZ0caG7UMLAiioVu0FVoe9YfQG/6YSM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)