UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YmCWwH8pAJcHHKaK0PrAGSMKnPSpOdMPIg7/mPQ/Iak='
WHERE
key_id = '7f0476f165b098bece2be7d1431c7f99a88dc32a3aef9c93f2fde72fbf241240'
AND (
token = 'YmCWwH8pAJcHHKaK0PrAGSMKnPSpOdMPIg7/mPQ/Iak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)