UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ao0GlljBRX1WnFdWzzbAKM2UfeI5FHNdWKmJgrzTXso='
WHERE
key_id = 'c7d89f2bbcde8840989f0e55f0945b811f1c2b8183d769355819b3730cf2e802'
AND (
token = 'Ao0GlljBRX1WnFdWzzbAKM2UfeI5FHNdWKmJgrzTXso='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)