UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PP6YTciX6r6djQq7BJeUOJI5rmt3ii6IS/50fX1652M=' 
WHERE 
  key_id = '8016e3508cd7b5ffbcbafbaed11ec564fea12c67c47e12eedd39906de9a394e9' 
  AND (
    token = 'PP6YTciX6r6djQq7BJeUOJI5rmt3ii6IS/50fX1652M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022