UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N3i9PyArIrT5uUhg0EPFBqjYAeixPNME9/nEwznAUy8=' 
WHERE 
  key_id = '01c30d8a3b0d147000e5a853d9323bc04bb5c0114fcdb5bdf33942746abfb76d' 
  AND (
    token = 'N3i9PyArIrT5uUhg0EPFBqjYAeixPNME9/nEwznAUy8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023