UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nsTwVv0EKu/O+p3dKU6S3JJpmudDSL6/F+iS2nESasU=' 
WHERE 
  key_id = 'e90682475f9eb2db03167b652ae48819956ece7773c1efd8b07579ccdc89fb99' 
  AND (
    token = 'nsTwVv0EKu/O+p3dKU6S3JJpmudDSL6/F+iS2nESasU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035