UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1nMlK08G70Ys8yB5bcOmnSB7upqCfikymJjUc7ASp1w='
WHERE
key_id = 'bf4941b88bd8e7db1deef5b27b01f4140ce256c8bb08335d2b523d6b2669a7b1'
AND (
token = '1nMlK08G70Ys8yB5bcOmnSB7upqCfikymJjUc7ASp1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)