UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZX56Ye0BTXECsMG58ApfxrofLVAMHJskCIFMa5r0t+Y='
WHERE
key_id = '6e7c2f8dc7fbe3b7b6e25ae761b3a857df4982a61ae75ef7f56ec16d826b5614'
AND (
token = 'ZX56Ye0BTXECsMG58ApfxrofLVAMHJskCIFMa5r0t+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)